<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta name="author" content="wangyuguo">
	<title>操作员密码重置</title>
	<script type="text/javascript" language="JavaScript" src="../script/common.js"></script>
	<script type="text/javascript" language="JavaScript" src="../script/tree.js"></script>
	<script type="text/javascript" language="JavaScript">
		var operator;
		function load() {
			Eui.showNavigation();//导航
			SystemMgnt.showOperator("detview");
		}
		
		function searchOperator(){
			if (!checkForm(searchForm)) return;
			var loginName = searchForm.loginName.value;
			DWR.call("partyService.getOperatorByLoginName", loginName,function(result){
				if (!result){
					showError("未找到操作员 "+loginName);return;
				}
				operator = result.operator;
				SystemMgnt.showOperator("detview",result);
				$("resetPswdBtn").disabled = false;
			});
		}
		
		function onCancel(){
			operator = null;
			searchForm.reset();
			$("resetPswdBtn").disabled = true;
			SystemMgnt.showOperator("detview");
		}
		
		function resetPassword(){
			if (!operator) return;
			var opts = {pinType:'operator'}
			var url = spellUrl("/card/input_cardpin.html",opts)		
			var pin = openDialogFrame(url,"请输入操作员的新密码",160,280);
			if (!pin){showWarning("输入密码被取消！");onCancel();return;}
				
			var password = openDialogFrame(url,"请重复输入操作员的新密码",160,280);
			if (!password){showWarning("输入密码被取消！");onCancel();return;}
			
			if (pin != password){showWarning("两次密码输入不一致！");return;}
			
			DWR.call("partyService.resetPassword", operator.uniqueId, password, function() {
				showInformation("重置密码成功");
				onCancel();
			},{blockScreen:true});
		}
	</script>
</head>

<body onload="load()" class="noScroll">
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="operatorview">
		<!--查询form-->
		<div class="form">
			<div class="formTitle">请输入操作员编号</div>
			<form id="searchForm" name="searchForm">
				<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label4">
					<tr>
						<td>
							<label>帐&nbsp;&nbsp;&nbsp;&nbsp;号</label>
							<input type="text" name="loginName" maxlength="20" onblur="checkV(this,'',true)"> <span class="des">*</span>
						</td>
						<td><button type="button" onclick="searchOperator()">查 询</button></td>
					</tr>
				</table>
			</form>
		</div>
	
		<div id="detview"></div>
		<p>
			<button disabled id="resetPswdBtn" onclick="resetPassword()">
				重置密码
			</button>
			<button onclick="onCancel()">重 置</button>
		</p>
	</div>
</body>
</html>